import java.util.ArrayList;
import java.util.List;

public class Solution {
    public List<String> fizzBuzz(int n) {
        List<String> list=new ArrayList<>();
        String[]arr=new String[n+1];//下标从1开始，记得多开一个空间
        int i=1;
        while(i<=n){
            if(i%3==0&&i%5==0){
                arr[i]="FizzBuzz";
                list.add(arr[i]);
            }else if(i%3==0){
                arr[i]="Fizz";
                list.add(arr[i]);
            }else if(i%5==0){
                arr[i]="Buzz";
                list.add(arr[i]);
            }else{
                arr[i]=String.valueOf(i);
                list.add(arr[i]);
            }
            i++;
        }
        return list;

    }
}